<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>插槽</title>
    </head>
    <body>
        <div id="app">
           <!-- <cpn1><button>哈哈哈哈</button></cpn1>

           <br>
           <cpn1><input type="text" value="请输入"></cpn1>

           <br>
           <cpn1><h2>一行文本</h2></cpn1>

           <br> -->
           <cpn1>
               <template slot-scope="slot11">
                <span v-for="zz in slot11.data">{{zz}}-- </span>
               </template>
           </cpn1>
           <br>
           <cpn1></cpn1>
           <br>
           <cpn1></cpn1>
           <br>
        </div>
        <template id="cpntem">
            <div>
              <h2>子组件</h2>
              <!-- <slot><span>左边</span></slot>
              <slot><span>中间</span></slot>
              <slot><span>右边</span></slot> -->
              <slot :data="codeLan">  
                  <ul><li v-for="item in codeLan">{{item}}</li></ul>
                </slot> 
            </div>
        </template>
        <script src="../vue.js"></script>
        <script>
            const app = new Vue({
                el:'#app',
                data:{
                  message:'hello'
                },
                methods:{
                    btnClick(){

                    }
                },
                components:{
                    cpn1:{
                        template:'#cpntem',
                        methods:{
                            showMessage(){
                             
                            }
                        },
                        data(){
                            return{
                                zzz:'得到zzz了',
                                codeLan:['C#','Java','go','C++']
                            }
                        }
                    }
                        
                }
            })
        </script>
        
    </body>
</html>